package org.pzy.java.base;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Author: DRevelation
 * @Date: 2023/3/1 14:12
 */
public class DateCal {
    public static void main(String[] args) throws ParseException {
        String dateString = "2023-03-01T09:05:22.701000Z";
        dateString = getDateTime(dateString);
        DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date date = df.parse(dateString);
        System.out.println(date);
    }

    private static String getDateTime(String dateString) {
        String[] arr = dateString.split("T");
        String substring = arr[1].substring(0, arr[1].lastIndexOf("."));
        return arr[0] + " " + substring;
    }
}
